From 795899f9d5583a163e6a61057d079ae6db393bb9 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Fri, 26 Jul 2019 17:07:58 +0200 Subject: [PATCH] wayland: Add xdg-output v3 support xdg-output v3 marks xdg-output.done as deprecated and compositors are not required to send that event anymore. So if the xdg-output version is 3 or higher, simply set the initial value `xdg_output_done` to TRUE so we don't wait/expect that event from the compositor. https://gitlab.gnome.org/GNOME/gtk/issues/2053 --- gdk/wayland/gdkdisplay-wayland.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index c02f7c66eb..931a9f5436 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -93,6 +93,7 @@ #define GTK_SHELL1_VERSION 2 #define OUTPUT_VERSION_WITH_DONE 2 +#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3 static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland); @@ -531,7 +532,7 @@ gdk_registry_handle_global (void *data, } else if (strcmp(interface, "zxdg_output_manager_v1") == 0) { - display_wayland->xdg_output_manager_version = MIN (version, 2); + display_wayland->xdg_output_manager_version = MIN (version, 3); display_wayland->xdg_output_manager = wl_registry_bind (display_wayland->wl_registry, id, &zxdg_output_manager_v1_interface, @@ -2217,6 +2218,9 @@ should_update_monitor (GdkWaylandMonitor *monitor) static void apply_monitor_change (GdkWaylandMonitor *monitor) { + GdkDisplay *display = GDK_MONITOR (monitor)->display; + GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display); + GDK_NOTE (MISC, g_message ("monitor %d changed position %d %d, size %d %d", monitor->id, @@ -2227,7 +2231,11 @@ apply_monitor_change (GdkWaylandMonitor *monitor) gdk_monitor_set_size (GDK_MONITOR (monitor), monitor->width, monitor->height); gdk_monitor_set_connector (GDK_MONITOR (monitor), monitor->name); monitor->wl_output_done = FALSE; - monitor->xdg_output_done = FALSE; + /* xdg_output v3 marks xdg_output.done as deprecated, so if using + * that version, no need to wait for xdg-output.done event. + */ + monitor->xdg_output_done = + (display_wayland->xdg_output_manager_version >= NO_XDG_OUTPUT_DONE_SINCE_VERSION); update_scale (GDK_MONITOR (monitor)->display); } -- 2.30.2